package com.py.admin.controller;

import com.py.apis.wemedia.ISensitiveClient;
import com.py.model.common.dtos.ResponseResult;
import com.py.model.wemedia.dtos.SensitiveDto;
import com.py.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {

    @Autowired
    private ISensitiveClient sensitiveClient;

    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {

        return sensitiveClient.listForSensitive(dto);
    }

    /**
     * 删除敏感词
     *
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")

    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return sensitiveClient.deleteSensitive(id);
    }

    /**
     * 新增敏感词
     *
     * @param sensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive sensitive) {
        return sensitiveClient.saveSensitive(sensitive);

    }
    /**
     * 修改敏感词
     * @param sensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive sensitive) {
        return sensitiveClient.updateSensitive(sensitive);
    }

}
